#include <windows.h>
#include <stdio.h>
#include "PowerControl.h"

int main()
{
    // 加载DLL
    HMODULE hDll = LoadLibrary("PowerControl.dll");
    if (!hDll)
    {
        printf("无法加载DLL\n");
        return 1;
    }
    
    // 获取函数指针
    typedef BOOL (*SystemShutdownFunc)(MyShutdownType, DWORD, LPCWSTR);
    SystemShutdownFunc SystemShutdown = (SystemShutdownFunc)GetProcAddress(hDll, "SystemShutdown");
    
    if (!SystemShutdown)
    {
        printf("无法获取函数地址\n");
        FreeLibrary(hDll);
        return 1;
    }
    
    // 示例1: 正常关机(30秒后)
    printf("将在30秒后关机...\n");
    SystemShutdown(MY_SHUTDOWN_NORMAL, 30, L"计算机将在30秒后关机，请保存您的工作");
    
    FreeLibrary(hDll);
    return 0;
}